<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>展示数据的另外一个页面</title>
<style type="text/css">
tbody td {
	height: 150px;
	border-bottom: 1px solid orange;
	width: 150px
}

.bg {
	background-color: red;
	color: white;
}
.bg a{
	color: white;
}

a {
	color: green;
}

a:hover {
	color: orange;
}
img{
vertical-align: middle;
text-align: center;
}
td{
text-align: center;
}
</style>

<link type="text/css" rel="stylesheet"
	href="${pageContext.request.contextPath}/css/style.css" />
</head>
<body>
	<table>
		<thead>
			<tr>
				<td>账号</td>
				<td>名字</td>
				<td>删除</td>
				<td>照片</td>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${userList}" var="item" varStatus="st">
				<tr <c:if test="${st.index%2==0}">class='bg'</c:if>>
					<td><c:out value="${item.loginName}"></c:out></td>
					<td><a href="ModifyUserByID?id=${item.id}"><c:out
								value="${item.userName}"></c:out></a></td>
					<td><input type="button" value="删除" onclick="areYouOK('${item.id}')" /></td>
					<td>
					<c:if test="${not empty item.headPic}">
					<img onerror="setDef(this)"    height="240" src="${pageContext.request.contextPath}/images/qq/${item.headPic}">
					</c:if>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<%@ include file="page.jsp" %>

	<script type="text/javascript">
	  function setDef(e) {
		 	 e.src ="${pageContext.request.contextPath}/images/df.jpg";
			}
	  
		function areYouOK(id) {
			if (confirm("请问确实要删除吗？")) {
				location.href = "RemoveUserServlet?id=" + id;
			}
		}
	</script>
</body>
</html>